class StudentEnrollmentsController < ApplicationController
  layout 'students'
  
  # GET /student_enrollments
  # GET /student_enrollments.xml
  def index
    @student_enrollments = StudentEnrollment.all

    respond_to do |format|
      format.html # index.html.erb
      format.xml  { render :xml => @student_enrollments }
    end
  end

  # GET /student_enrollments/1
  # GET /student_enrollments/1.xml
  def show
    @student_enrollment = StudentEnrollment.find(params[:id])

    respond_to do |format|
      format.html # show.html.erb
      format.xml  { render :xml => @student_enrollment }
    end
  end

  # GET /student_enrollments/new
  # GET /student_enrollments/new.xml
  def new
    @student_enrollment = StudentEnrollment.new

    respond_to do |format|
      format.html # new.html.erb
      format.xml  { render :xml => @student_enrollment }
    end
  end

  # GET /student_enrollments/1/edit
  def edit
    @student_enrollment = StudentEnrollment.find(params[:id])
  end

  # POST /student_enrollments
  # POST /student_enrollments.xml
  def create
    @student_enrollment = StudentEnrollment.new(params[:student_enrollment])

    respond_to do |format|
      if @student_enrollment.save
        flash[:notice] = 'StudentEnrollment was successfully created.'
        format.html { redirect_to(@student_enrollment) }
        format.xml  { render :xml => @student_enrollment, :status => :created, :location => @student_enrollment }
      else
        format.html { render :action => "new" }
        format.xml  { render :xml => @student_enrollment.errors, :status => :unprocessable_entity }
      end
    end
  end

  # PUT /student_enrollments/1
  # PUT /student_enrollments/1.xml
  def update
    @student_enrollment = StudentEnrollment.find(params[:id])

    respond_to do |format|
      if @student_enrollment.update_attributes(params[:student_enrollment])
        flash[:notice] = 'StudentEnrollment was successfully updated.'
        format.html { redirect_to(@student_enrollment) }
        format.xml  { head :ok }
      else
        format.html { render :action => "edit" }
        format.xml  { render :xml => @student_enrollment.errors, :status => :unprocessable_entity }
      end
    end
  end

  # DELETE /student_enrollments/1
  # DELETE /student_enrollments/1.xml
  def destroy
    @student_enrollment = StudentEnrollment.find(params[:id])
    @student_enrollment.destroy

    respond_to do |format|
      format.html { redirect_to(student_enrollments_url) }
      format.xml  { head :ok }
    end
  end
end
